package catgory.classLoaderTest;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;

/**
 * describe:
 *
 * @author huxingjie
 * @date 2019/03/20
 * @since 3.4
 */
public class IpcContext {

    private AtomicLong resultIdx = new AtomicLong();//2

    private IpcContext() {//1
    }

    private static class IpcContextHolder {
        private final static IpcContext INSTANCT = new IpcContext();//4
    }

    public static IpcContext getInstance() {//3
        return IpcContextHolder.INSTANCT;
    }

    public Long getAtomicLong() {//5
        return resultIdx.incrementAndGet();
    }

    public static void main(String[] args) throws UnknownHostException {
        Long resultIdx = IpcContext.getInstance().getAtomicLong();
        System.out.println(resultIdx);
        Float threshold = 1.0f;
        System.out.println(Float.compare(threshold, 0f));
        ;

        File file = new File("D:\\uploads\\6c369bda94ab12efd65de68f3c899dd9");
        try {
            FileUtils.deleteDirectory(file);
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println(InetAddress.getLocalHost().getHostAddress());
        String s = "111.11111111111111111111111111";
        System.out.println(Long.valueOf(s));

    }


}

    